<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:xhtml />
<script type="text/javascript">
    function hideExcel(){
        $("#snpGeneExcel").toggle();
    }

    function fileTip(){
        $("#fileTip").dialog({
            autoOpen:true
        })
    }

    function textTip(){
        $("#textTip").dialog({
            autoOpen:true
        })
    }

    function useText(){
        $("#useText").show();
        $("#useFile").hide();
    }

    function useFile(){
        $("#useFile").show();
        $("#useText").hide();
    }

    function featureTip(){
        $("#featureTip").dialog({
            autoOpen:true
        })
    }
</script>
<div id="snpGene" class="content input">
    <h2><html:link style="float:left;" href="#" styleClass="ui-icon help ui-icon-info" onclick="featureTip()"></html:link>SNP to Gene</h2>
    <html:errors property="snpGene" />
    <html:errors property="snpList" />
    <html:form action="snpGene" enctype="multipart/form-data">
        <dl>
            <dt>How would you like to input genes?</dt>
            <dd>
                <html:radio property="useTextarea" value="text" onclick="useText()">Text</html:radio>
                <html:radio property="useTextarea" value="file" onclick="useFile()">File Upload</html:radio>
            </dd>
        </dl>
            <logic:equal property="useTextarea" name="snpGeneForm" value="file">
                <div id="useFile" style="display:block">
            </logic:equal>
            <logic:notEqual property="useTextarea" name="snpGeneForm" value="file">
                <div id="useFile" style="display:none">
            </logic:notEqual>
                    <dl>
            <dt>Upload SNP List:<html:link href="#" styleId="generalHelpButton" styleClass="ui-icon help ui-icon-info" onclick="fileTip()"></html:link></dt>
            <dd class="ddpositionFix"><html:file property="file"/></dd>
            </dl>
            </div>

            <logic:equal property="useTextarea" name="snpGeneForm" value="text">
                <div id="useText" style="display:block">
            </logic:equal>
            <logic:notEqual property="useTextarea" name="snpGeneForm" value="text">
                <div id="useText" style="display:none">
            </logic:notEqual>
                    <dl>
                <dt>Enter SNP List:<html:link href="#" styleClass="ui-icon help ui-icon-info" onclick="textTip()"></html:link></dt>
                <dd class="ddpositionFix"><html:textarea property="textInput"></html:textarea></dd>
                </dl>
            </div>
                <dl>
            <dt>Map genes <html:text property="streamOffset">0</html:text>kb upstream and downstream of each SNP's position</dt>
            <dd>&nbsp;</dd>
            <dt>Skip results page and export data?</dt>
            <dd><html:checkbox property="excel" onclick="hideExcel()"/> (Recommended for large datasets)</dd>
            </dl>
            <logic:equal name="snpGeneForm" property="excel" value="true">
                <div id="snpGeneExcel" style=" display: none">
                </logic:equal>
                <logic:notEqual name="snpGeneForm" property="excel" value="true">
                    <div id="snpGeneExcel" style=" display: none">
                    </logic:notEqual>
                    <dl>
                        <dt>Filename:</dt>
                        <dd><html:text property="filename"/></dd>
                        <dt>Delimiter:</dt>
                        <dd><html:select property="dlimiter">
                                <html:option value="tab">Tab Delimited</html:option>
                                <html:option value="csv">Comma Separated</html:option>
                            </html:select>
                        </dd>
                    </dl>
                </div>
        <html:submit value="Next" property="submitType" />
    </html:form>
</div>

                                        <div id="featureTip" style="display:none">
                        This feature queries the NCBI database for the genes that the SNP falls on. The results are displayed on an interactive table with sorting, paging, and filtering capabilities.
                    </div>
<div id="fileTip" style="display:none">
    The file should be formatted as one SNP (RS Number) per line.<br/>
    <br/>
    Accepts CSV, XLS, and Tab-delimited TXT files.
</div>

<div id="textTip" style="display:none">
    Text input should be formatted like:<br/>
    "RS Number"<br/>
    <br/>
    For example:<br/>
    rs1067<br/>
</div>